Page({
  data:{
    data:{
      form_data: {},
    }
  },

  onSubmit(e) {
    // my.alert({
    //   content: `数据：${JSON.stringify(e.detail.value)}`,
    // });
    this.setData({
      form_data: JSON.stringify(e.detail.value),
    });
    
    this.requestToBackend_errandMen_form_list(this.data.form_data);
  },

  // errandMen_form_list
  requestToBackend_errandMen_form_list(data){
    const that = this;
    // const apiUrl = 'https://localhost:3000/php/1.php'; // 替换成你的后端接口地址
    // const apiUrl = 'http://172.20.55.210:10086/product/getproducts'; // 替换成你的后端接口地址
    const apiUrl = 'http://172.20.55.210:10086/errandMen'; // 替换成你的后端接口地址

    console.log(data); //.detail.value
    console.log('正在传向后端');

    my.request({
      url: apiUrl,
      method: 'POST',
      data: data,
      dataType: 'json',
      success: resp => {
        console.log(resp.data);
        goodsList = resp.data;
        my.alert({ content: 'success' });
      },
      fail: error => {
        console.error('请求失败：', error);
        my.alert({ content: '请求失败，详细错误信息请查看控制台' });
      },
    });
  }
})